<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<html>
<head>
<title>新闻列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table width="96%">
  <tr bgcolor="#6699CC">
    <td colspan="6">
	<table width="100%">
      <tr bgcolor="#6699CC">
        <td height="25"><input name="product_add" type="button" onClick="window.location='${webpath}/admin/product/product_add.jsp?productleibieID=${param.productleibieID }&page=${page_content.pagecur}'" value="添加产品">
		</td>
        <td><font color="WHITE" style="font-size:16px; font-weight:bold;">产品列表（共${page_content.pages }页${page_content.counts }个产品）</font></td>
		<td align="right">

		</td>
      </tr>
    </table></td>
  </tr>
  <tr bgcolor="#6699CC">
    <td height="25">编号</td>
    <td>产品名称</td>
    <td>发布时间</td>
    <td>状态</td>
    <td>编辑</td>
    <td>操作</td>
  </tr>
  <c:forEach var="product_list" items="${product_list}">
  <tr>
    <td height="25"><input type="checkbox" name="check_box" id="check_box" value="${product_list.id}" />&nbsp;${product_list.id }</td>
    <td>${fn:substring(product_list.product_name,0,26) }</td>
    <td>${fn:substring(product_list.create_time,0,10) }</td>
    <td>
		<c:choose>
			<c:when test="${product_list.product_audit eq 0 }"><a href="${webpath}/admin/product/Product.do?action=updateProductAudit&id=${product_list.id }&audit=${product_list.product_audit}&page=${page_content.pagecur}&productleibieID=${param.productleibieID}">未审核</a></c:when>
			<c:otherwise><a href="${webpath}/admin/product/Product.do?action=updateProductAudit&id=${product_list.id }&audit=${product_list.product_audit}&page=${page_content.pagecur}&productleibieID=${param.productleibieID}">已审核</a></c:otherwise>
		</c:choose>
	</td>
    <td><a href="${webpath}/admin/product/Product.do?action=updateProductView&id=${product_list.id }&page=${page_content.pagecur}">修改</a></td>
    <td><a href="${webpath}/admin/product/Product.do?action=deleteProduct&id=${product_list.id }&page=${page_content.pagecur}&productleibieID=${param.productleibieID}">删除</a></td>
  </tr>
  </c:forEach>
  <tr>
  	<td colspan="6" align="right">
	<form method="post" action="" id="all" name="all">
		<input type="radio" name="all_option" id="all_option" value="all_transfer">类别转移
		&nbsp;<input type="radio" name="all_option" id="all_option" value="all_delete">删除选中
		<input type="hidden" name="productleibieID" id="productleibieID" value="${param.productleibieID }" />
		<input type="hidden" name="ids" id="ids" value="" />
		<input type="hidden" name="page" id="page" value="${page_content.pagecur}" />
		&nbsp;<input type="button" name="button" id="button" value="提交" onClick="all_oper()" />
	</form>
	</td>
  </tr>
  <tr>
    <td colspan="6">
		<table width="100%">
			  <tr>
				<td align="center" height="30">
				<form id="rollpage" method="post" action="${webpath}/admin/product/Product.do?action=findProducts">
				<input type="hidden" name="page"/>
				<input type="hidden" name="productleibieID" value="${page_content.productleibieID }" />
				</form>
				<p align="center">
					<c:import url="/common/rollpage.jsp"></c:import>
				</p>
				</td>
			  </tr>
    	</table>
	</td>
  </tr>
</table>
</body>
<script>
	function all_oper()
	{
		var check_box=document.getElementsByName("check_box");
		var str="",temp_i=0;
		for(var i=0;i<check_box.length;i++)
		{
			if(check_box[i].checked)
			{
				if(temp_i==0)
				{
					str+=check_box[i].value;
					temp_i++;
				}
				else
				{
					str+=","+check_box[i].value;
				}
			}
		}
		document.getElementById("ids").value=str;
		if(document.getElementById("all").all_option[0].checked  && str!="")
			alert("没实现......");
			//location.href="";
		else if(document.getElementById("all").all_option[1].checked && str!="")
		{
			document.getElementById("all").action="${webpath}/admin/news/Articles.do?action=deleteBatchNews";
			document.getElementById("all").submit();
		}
	}
</script>
</html>
